<!DOCTYPE html>
<html>
	<head>
		<title>业务表配置</title>
		<#include "/header.html">
	</head>
	<body>
	<div id="rrapp" v-cloak>
		<div v-show="showList">
			<div class="grid-btn">
				<div class="form-group col-sm-2">
					<input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="字典名称">
				</div>
				<a class="btn btn-default" @click="query">查询</a>
				<#if shiro.hasPermission("gen:genTable:save")>
					<a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
				</#if>
				<#if shiro.hasPermission("gen:genTable:update")>
					<a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
				</#if>
				<#if shiro.hasPermission("gen:genTable:delete")>
					<a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
				</#if>
			</div>
			<table id="jqGrid"></table>
			<div id="jqGridPager"></div>
		</div>

		<div v-show="!showList && !showChildList" class="panel panel-default">
			<div class="panel-heading">{{title}}</div>
			<form class="form-horizontal">
				<div class="form-group">
					<div class="col-sm-2 control-label">表名</div>
					<div class="col-sm-10">
						<select class="form-control input-medium" id="tableName" >
							<option v-for="table in tableList" :value="table.name">{{table.name}}</option>
						</select>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-2 control-label"></div>
					<input type="button" class="btn btn-primary" @click="nextStep" value="下一步"/>
					&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
				</div>
			</form>
		</div>

		<div v-show="showChildList" class="panel panel-default">
			<div class="panel-heading">{{title}}</div>
			<form class="form-horizontal">
				<div class="form-group">
					<div class="col-sm-2 control-label">表名</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="genTable.name" placeholder="表名"/>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-2 control-label">说明</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="genTable.comments" placeholder="说明"/>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-2 control-label">类名</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="genTable.className" placeholder="类名"/>
					</div>
				</div>



			<!-- -->
			<div class="panel panel-default">
				<table id="contentTable" class="table table-striped table-bordered table-condensed">
					<thead>
						<tr>
							<th title="数据库字段名">列名</th>
							<th title="默认读取数据库字段备注">说明</th>
							<th title="数据库中设置的字段类型及长度">物理类型</th>
							<th title="实体对象的属性字段类型">Java类型</th>
							<th title="实体对象的属性字段（对象名.属性名|属性名2|属性名3，例如：用户user.id|name|loginName，属性名2和属性名3为Join时关联查询的字段）">Java属性名称 <i class="icon-question-sign"></i></th>
							<th title="是否是数据库主键">主键</th>
							<th title="字段是否可为空值，不可为空字段自动进行空值验证">可空</th>
							<th title="选中后该字段被加入到insert语句里">插入</th>
							<th title="选中后该字段被加入到update语句里">编辑</th>
							<th title="选中后该字段被加入到查询列表里">列表</th>
							<th title="选中后该字段被加入到查询条件里">查询</th>
							<th title="该字段为查询字段时的查询匹配放松">查询匹配方式</th>
							<th title="字段在表单中显示的类型">显示表单类型</th>
							<th title="显示表单类型设置为“下拉框、复选框、点选框”时，需设置字典的类型">字典类型</th>
							<th>排序</th>
						</tr>
					</thead>
					<tbody v-for="(column,index) in genTable.columnList">
						<tr class="error" title="已删除的列，保存之后消失！">
							<td nowrap>
								<!--<input type="hidden" name="columnList[$index].id" v-model="column.id"/>
								<input type="hidden" name="columnList[$index].delFlag" v-model="{{column.delFlag}}"/>
								<input type="hidden" name="columnList[$index].genTable.id" v-model="{{column.genTableId}}"/>
								<input type="hidden" name="columnList[$index].name" v-model="{{column.name}}"/>-->{{column.name}}
							</td>
							<td>
								<input type="text" :name="'columnList[' + index + '].comments'" v-model="column.comments" maxlength="200" class="required" style="width:100px;"/>
							</td>
							<td nowrap>
								<!--<input type="hidden" :name="columnList[$index].jdbcType" v-model="column.jdbcType"/>-->{{column.jdbcType}}
							</td>
							<td>
								<select  :name="'columnList[' +index + '].javaType'" v-model="column.javaType" class="required input-mini" style="width:85px;*width:75px">
									<option v-for="dict in javaTypeList"  :value="dict.value">{{dict.label}}</option>
								</select>
							</td>
							<td>
								<input type="text" :name="'columnList[' + index + '].javaField'" v-model="column.javaField" maxlength="200" class="required input-small"/>
							</td>
							<td>
								<input type="checkbox" name="columnList[$index].isPk" true-value="1" false-value = "0" v-model="column.isPk" :checked="column.isPk==1"/>
							</td>
							<td>
								<input type="checkbox" name="columnList[$index].isNull" true-value="1" false-value = "0" v-model="column.isNull" :checked="column.isNull==1"/>
							</td>
							<td>
								<input type="checkbox" name="columnList[$index].isInsert" true-value="1" false-value = "0" v-model="column.isInsert" :checked="column.isInsert==1"/>
							</td>
							<td>
								<input type="checkbox" name="columnList[$index].isEdit" true-value="1" false-value = "0" v-model="column.isEdit" :checked="column.isEdit==1"/>
							</td>
							<td>
								<input type="checkbox" name="columnList[$index].isList" true-value="1" false-value = "0" v-model="column.isList" :checked="column.isList==1"/>
							</td>
							<td>
								<input type="checkbox" name="columnList[$index].isQuery" true-value="1" false-value = "0" v-model="column.isQuery" :checked="column.isQuery==1"/>
							</td>
							<td>
								<select  name="columnList[$index].queryType" v-model="column.queryType" class="required input-mini">
									<option v-for="dict in queryTypeList"  :value="dict.value">{{dict.label}}</option>
								</select>
							</td>
							<td>
								<select  name="columnList[$index].showType" v-model="column.showType" class="required" style="width:100px;">
									<option v-for="dict in showTypeList"  :value="dict.value">{{dict.label}}</option>
								</select>
							</td>
							<td>
								<input type="text" name="columnList[$index].dictType" v-model="column.dictType" maxlength="200" class="input-mini"/>
							</td>
							<td>
								<input type="text" name="columnList[$index].sort" v-model="column.sort" maxlength="200" class="required input-min digits"/>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
				<div class="form-group">
					<div class="col-sm-2 control-label"></div>
					<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
					&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
				</div>
			</form>

		</div>
	</div>

	<script src="${request.contextPath}/static/js/modules/gen/genTable.js?_${.now?long}"></script>
	</body>
</html>